#include "game.h"

const int kFPS = 60;
const int kDelayTime = 1000.0f / kFPS;

int main(int argc, char* argv[]) {
    if(TheGame::instance().Init("MyGame", 100, 100, 640, 480, false)) {
        Uint32 frame_start, frame_time;
        while(TheGame::instance().Running()) {
            frame_start = SDL_GetTicks();

            TheGame::instance().HandleEvents();
            TheGame::instance().Update();
            TheGame::instance().Render();

            frame_time = SDL_GetTicks() - frame_start;
            if (frame_time < kDelayTime) {
                SDL_Delay((int)(kDelayTime - frame_time));
            }
        }
    }
    else {
        return -1;
    }

    TheGame::instance().Clean();

    return 0;
}
